<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<script>

  function setCookie(name, value, day) {
    let date = new Date()
    date.setDate(date.getDate() + day)
    document.cookie = name + "=" + value + ";expires=" + date
  }
  function getCookie(name) {
    let arr = document.cookie.split("; ")
    for (let i = 0; i < arr.length; i++) {
      let arr2 = arr[i].split("=")
      if (arr2[0] == name) {
        return arr2[1]
      }
    }
    return ""
  }
  function delCookie(name) {
    setCookie(name, 1, -1)
  }
  setCookie("键1", "值1", 7)
  delCookie("键1")
  console.log(getCookie("键1"));
  console.log(document.cookie);

</script>

<body>


</body>

</html>